/*
 * @Author: your name
 * @Date: 2021-12-15 07:33:23
 * @LastEditTime: 2021-12-16 07:58:14
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \day7\my-app\src\router\index.js
 */
/*
 * @Author: your name
 * @Date: 2021-12-15 07:33:23
 * @LastEditTime: 2021-12-15 16:57:21
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \day7\my-app\src\router\index.js
 */
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [{
    path: '/',
    name: 'Index',
    redirect:"/home"
  },
  {
    path: '/home',
    name: 'Home',
    redirect: "/home/oreder",
    component: Home,
    children: [{
      path: 'oreder',
      name: 'Oreder',
      meta: {
        title: "点餐"
      },
      component: () => import('../views/Home/Oreder.vue')
    }, {
      path: 'evaluate',
      name: 'Evaluate',
      meta: {
        title: "评价"
      },
      component: () => import('../views/Home/Evaluate.vue')
    }, {
      path: 'merchant',
      name: 'Merchant',
      meta: {
        title: "商家"
      },
      component: () => import('../views/Home/Merchant.vue')
    }]
  },{
      path: '/detail',
      name: 'Detail',
      component: () => import('../views/Detail.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

// router.beforeEach((to, from, next) => {
//   document.title=to.meta.title
//   next()
// })

export default router